# bu sürüm rustup ile derlenmiştir.

mkdir "$KAYNAK_DIZIN/rust" || true
export CARGO_HOME="$KAYNAK_DIZIN/rust"

# https://bugzilla.mozilla.org/show_bug.cgi?id=1530052
#patch -Np1 -i ../0001-Use-remoting-name-for-GDK-application-names.patch

  cat >.mozconfig <<END
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/firefox-shared
unset MOZ_TELEMETRY_REPORTING
ac_add_options --prefix=/usr
ac_add_options --enable-default-toolkit=cairo-gtk3
ac_add_options --enable-application=browser
ac_add_options --with-system-jpeg
ac_add_options --with-system-zlib
ac_add_options --with-system-nspr
ac_add_options --with-system-nss
ac_add_options --enable-av1
ac_add_options --enable-system-ffi
ac_add_options --enable-system-pixman
ac_add_options --enable-alsa
ac_add_options --enable-optimize
ac_add_options --enable-release
ac_add_options --enable-rust-simd
ac_add_options --disable-debug-symbols
ac_add_options --enable-official-branding
ac_add_options --with-distribution-id=org.milislinux
ac_add_options --enable-linker=lld
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --disable-updater
ac_add_options --disable-crashreporter
ac_add_options --disable-necko-wifi
ac_add_options --disable-elf-hack
ac_add_options --without-wasm-sandboxed-libraries
END

export CC=clang CXX=clang++ AR=llvm-ar NM=llvm-nm RANLIB=llvm-ranlib
export MOZ_MAKE_FLAGS="${MAKEJOBS}"
export MOZBUILD_STATE_PATH=".mozbuild"
export MOZ_NOSPAM=1
export MACH_USE_SYSTEM_PYTHON=1

# install cbindgen with cargo way
cargo install cbindgen
export PATH=/root/.cargo/bin/:$PATH

./mach build
